import service from "../index";
export const getAdress = () => {
      return service({
          method:'GET',
          url:'/p/address/list',
          
      })
  
    return new Promise((res) => {
      res({
          code:200,
          data:[
              {
                  name: '小明',
                  phone: '12345678915',
                  address: '广东省佛山市南海区',
                  moreAddres: '桂城街桂城街道桂城街道桂城街道道',
                  isdefult: 1, // 是否为默认地址  1默认 0非默认
                  id: 1,
                  isCheck:true,// 是否被选中为收货地址
              }, 
              {
                  name: '小红',
                  phone: '12345678915',
                  address: '广东省广州市海珠区',
                  moreAddres: '昌岗路15号',
                  isdefult: 0,// 是否为默认地址 1默认 0非默认
                  id: 2,
                  isCheck:false,// 是否被选中为收货地址
              }
          ]
      });
    });
  };



  export const defaultAddr = (str,params) => {
    return service({
        method:'PUT',
        url:`/p/address/defaultAddr/${str}`,
        params
    })


};


export const updateAddr = (data) => {
    return service({
        method:'PUT',
        url:`p/address/updateAddr`,
        data
    })


};




export const addAddr = (data) => {
    return service({
        method:'POST',
        url:`/p/address/addAddr`,
        data
    })


};


export const deleteAddr = (str) => {
    return service({
        method:'DELETE',
        url:`/p/address/deleteAddr/${str}`,
        
    })


};